<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>房屋信息</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <style type="text/css">
        .icon {
            width: 1em;
            height: 1em;
            vertical-align: -0.15em;
            fill: currentColor;
            overflow: hidden;
        }
        img{
            width: 100%;
        }
    </style>
    <script src="__TMPL__/public/assets/wuye/js/mui.min.js"></script>
    <link href="__TMPL__/public/assets/wuye/css/mui.min.css" rel="stylesheet"/>
    <link rel="stylesheet" type="text/css" href="__TMPL__/public/assets/wuye/css/app.css" />
    <script src="__TMPL__/public/assets/wuye/js/iconfont.js"></script>
</head>

<body>
<header class="mui-bar mui-bar-nav">
    <a class="mui-icon mui-icon-left-nav mui-pull-left" href="javascript:window.history.go(-1);"></a>
    <!--<a class="mui-icon mui-icon mui-icon-checkmarkempty  mui-pull-right" style="color: orange;font-size: 3em;padding-top: 0px;margin-top: -4px;" id="save"></a>-->
    <a class="mui-pull-right" id="save" style="color: orange;font-size: 20px;padding-top: 0px;margin-top: 8px;">
        <if condition="!empty($dbres.louhao)&&!empty($dbres.danyuanhao)&&!empty($dbres.louceng)&&!empty($dbres.fangjianhao)"> <else />保存</if>
    </a>

</header>
{:widget('Wuye/nav')}
<div class="mui-content">
    <div class="mui-card">
        <div class="mui-card-content">
            <div class="mui-card-content-inner">
                <div class="mui-collapse-content">
                    <form class="mui-input-group">
                        <div class="mui-input-row">
                            <label>楼号</label>
                            <input type="text" class="mui-input-clear" placeholder="请输入楼号" id="lou" <notempty name="$dbres.louhao">readonly</notempty> value="{$dbres.louhao|default=''}">
                            <span class="mui-icon mui-icon-clear mui-hidden"></span>
                        </div>
                        <div class="mui-input-row">
                            <label>单元号</label>
                            <input type="text"  class="mui-input-clear" placeholder="请输入单元号" id="dan"<notempty name="$dbres.danyuanhao">readonly</notempty> value="{$dbres.danyuanhao|default=''}">
                            <span class="mui-icon mui-icon-clear mui-hidden"></span>
                        </div>
                        <div class="mui-input-row">
                            <label>楼层</label>
                            <input type="text"  class="mui-input-clear" placeholder="请输入楼层" id="ceng" <notempty name="$dbres.louceng">readonly</notempty> value="{$dbres.louceng|default=''}">
                            <span class="mui-icon mui-icon-clear mui-hidden"></span>
                        </div>
                        <div class="mui-input-row">
                            <label>房间号</label>
                            <input type="text"  class="mui-input-clear" placeholder="请输入房间号" id="fang" <notempty name="$dbres.fangjianhao">readonly</notempty> value="{$dbres.fangjianhao|default=''}">
                            <span class="mui-icon mui-icon-clear mui-hidden"></span>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script src="__TMPL__/public/assets/wuye/js/mui.min.js"></script>
<script src="__TMPL__/public/assets/wuye/js/iconfont.js"></script>
<script>
    mui.init({
        swipeBack:true //启用右滑关闭功能
    });
    mui("#save")[0].addEventListener("tap",function(){
        var lou = document.getElementById("lou").value;
        var dan = document.getElementById("dan").value;
        var ceng = document.getElementById("ceng").value;
        var fang = document.getElementById("fang").value;
        // if(lou == ''||lou==null){mui.toast('楼号不能为空');return false;}
        // if(dan == ''||dan==null){mui.toast('单元号不能为空');return false;}
        // if(ceng == ''||ceng==null){mui.toast('楼层不能为空');return false;}
        // if(fang == ''||fang==null){mui.toast('房间号不能为空');return false;}
        // var address = lou+'号楼'+dan+'单元'+ceng+'层'+fang;
        mui.ajax("{:url('portal/wuye/addressSave')}",{
            data:{
                louhao:lou,
                danyuanhao:dan,
                louceng:ceng,
                fangjianhao:fang,
            },
            dataType:'json',//服务器返回json格式数据
            type:'post',//HTTP请求类型
            timeout:10000,//超时时间设置为10秒；
            headers:{'Content-Type':'application/json'},
            success:function(data){
                if(data.code == 1){
                    mui.toast("保存成功,返回上一页");
                    window.history.go(-1);
                }else{
                    mui.toast(dat.msg);
                }
            },
            error:function(xhr,type,errorThrown){
                //异常处理；
                console.log(type);
            }
        });
    });
</script>
</html>